<?=view('job.common.header')?>
<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12 col-sm-12 header-bg">
            <h4 class=" col-xs-12 col-sm-12 text-center">任务详情</h4>
        </div>
        <?php if($job && count($job)): ?>
        <div class="col-xs-12 col-sm-12">
            <ul class="col-xs-12 col-sm-12 xhx">
                <li><b>任务编号：</b><span><?=$job->jnum?></span></li>
                <li><b>客户名称：</b><span><?=$job->cname?></span>
                    <a href="tel:<?=$job->cphone ?>"><img style="width: 15%; float: right" src="<?=asset("images/dhbh.png")?>"></a>
                </li>
                <li><b>联系方式：</b><span><?=$job->cphone ?></span></li>
                <li><b>派单时间：</b><span><?=$job->strCtime()?></span></li>
                <li><b>地　　址：</b><span><?=$job->address?></span></li>
                <li><b>是否转派：</b><kbd><?=$job->strIsResend();?></kbd></li>
                <li><b>任务状态：</b><kbd><?=$job->strJobStatus();?></kbd></li>
                <?php if ($job->jstatus == 0): ?>
                <li style="color: #ff0000;"><b>任务用时：</b><kbd id="day"></kbd> 天 <kbd id="hour">0</kbd> 时 <kbd id="min">0</kbd> 分 <kbd id="sec">0</kbd> 秒</li>
                <script>
                    setInterval('usetime(<?=$job->ctime?>)', 1000);
                </script>
                <?php endif; ?>
            </ul>
        </div>
        <?php if ($job->jstatus == 0): ?>
        <div class="footer cal-xs-12 col-sm-12 text-center">
            <a href="<?=url("job/index/tick/{$job->id}")?>" class="cal-xs-4 col-sm-4 mgin">
            <img class="bfb" src="<?=asset("images/zwtd.png")?>"/>
            </a>
            <a href="<?=url("job/index/tick/{$job->id}")?>" class="cal-xs-4 col-sm-4 mgin eveRec">
            <img class="bfb" src="<?=asset("images/zwhd_btn.png")?>"/>
            </a>
            <a href="<?=  url('job/index/myjob')?>" class="cal-xs-4 col-sm-4 mgin"><img class="bfb" src="<?=asset("images/zwfh.png")?>"/></a>
        </div>
        <?php endif; ?>
        <?php else: ?>
        <div class="help-block">任务不存在<a href="<?=url("job/index/index")?>">返回首页</a></div>
        <?php endif;?>
    </div>
</div>
<script>
    function usetime(start) {
        var date = new Date(), s = start+'000', dif = date.getTime() - s;
        $("#day").html(Math.floor(dif / (1000*60*60*24)));
        var hour = dif % (1000*60*60*24);
        $("#hour").html(Math.floor(hour / (1000*60*60)));
        var min = hour % (1000*60*60);
        $("#min").html(Math.floor(min / (1000*60)));
        var sec = min % (1000*60);
        $("#sec").html(Math.floor(sec / 1000));
    }
    $('.eveRec').click(function(){
        var url = $(this).attr('href');
        var layeri = layer.open({
            content: '确定要进行回单操作？？',
            btn: ['确认', '取消'],
            shadeClose: false,
            style: "background-color:#09C1FF; color:#fff; border:none;",
            yes: function(){
                $.get(url, {jstatus: 2}, function(data) {
                    layer.open({content: data.info, style: "background-color:#09C1FF; color:#fff; border:none;", time: 2});
                    if (data.status == 1) {
                        window.setTimeout(function(){window.location.href='<?=url('job/index/myjob')?>'}, 2000);
                    }
                })
            }, no: function(){
                layer.close(layeri);
            }
        });
        return false;
    });
</script>
<?=view('job.common.footer')?>